package lc.二叉树.剑指Offer;

import utils.TreeNode;

/**
 * @description:
 * @author: qian
 * @createDate: 2021/10/18
 */
public class Math剑指Offer27_二叉树的镜像 {

    public TreeNode mirrorTree(TreeNode root) {

        // 前序遍历的典型应用
        if(root == null) {
            return null;
        }
        TreeNode temp = root.left;
        root.left = root.right;
        root.right = temp;
        mirrorTree(root.left);
        mirrorTree(root.right);
        return root;
    }
}
